<?php 
include('../include/db_connect.php');
	function inDB() {
		$password = md5($_SERVER['PHP_AUTH_PW']);
		$queryL="SELECT idUSERNAME, gebruikers_naam, wachtwoord FROM USERNAME
	             WHERE
	             gebruikers_naam='".$_SERVER['PHP_AUTH_USER']."'
	             AND
	             wachtwoord='".$password."'
	             AND
	             admin = 1
                 AND
                 status='act'";
	
		$resL=   mysql_query($queryL) or die(mysql_error());
		$usR =   mysql_fetch_array($resL);
		if ($usR===false) return false;
		return $usR['idUSERNAME'];
	}
	$usR = inDB();
		


?>
<style type="text/css">
div#noPermission{
margin-left:auto;
margin-right:auto;
text-align:center;
}
#noPermission a{
text-decoration:none;
color: #000000;
}
#noPermission a:hover{
text-decoration:none;
color: #ff0000;
}
#noPermissionImage a{
margin-top:-30px;
margin-left:auto;
margin-right:auto;
background-image:url('images_admin/icon_stop.png');
display:block;
width:512px;
height:512px;
text-decoration:none;
color: #000000;
}
#noPermissionImage a:hover{
margin-top:-30px;
margin-left:auto;
margin-right:auto;
background-image:url('images_admin/icon_stop2.png');
display:block;
width:512px;
height:512px;
text-decoration:none;
color: #ff0000;
}
</style>
<?php
if(!isset($_SERVER['PHP_AUTH_USER'])||$usR===false)
  {
    Header("WWW-Authenticate: Basic realm=\"Vul je gebruikersnaam en wachtwoord in\"");
    Header("HTTP/1.0 401 Unauthorized");
    echo '<div id="noPermission">';
	echo '<h1> U heeft geen authorisatie om hier te komen.</h1><br>';
	echo '<div id="noPermissionImage">';
	echo '<a href="../index.php"></a>';
	echo '</div>';
	echo '<h1> <a href="../index.php">Klik hierom terug te gaan naar de index site</a> </h1><br>';
	echo '</div>';

   }
	else
	  {
	  	include 'include/admin_header.php';
		include 'include/admin_menu.php';
		echo "<div id='main_content'>";
		echo "<div id='super_main_content'>";
		echo "<h2>Let op! Weet dat na verwijdering de klant geen bestellingen meer kan doen!!</h2>";
		echo "<br>";
		echo "<form method = 'POST' action='".$_SERVER['PHP_SELF']."?id=".$_GET['id']."'>";
		echo "<input type='submit' value='Ik ben mij bewust van dit risico: verwijder de klant.'></input>";
		echo "</form>";
		
		echo "</div>";
		echo "</div>";
		echo "<div class='clearthis'></div>";
		include 'include/admin_footer.php';
			  	
	  }
?>